home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / C-D / DeveloperStax.cpt / Developer Stack 1.0 / card_6668.txt < prev    next >
Text File  |  1989-02-26  |  4KB  |  155 lines

  1. -- card: 6668 from stack: in.0
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 3837
  5. -- name: PopUpMenu
  6. ----- HyperTalk script -----
  7. on closecard
  8.   hide message window
  9. end closecard
  10.  
  11.  
  12. -- part 1 (button)
  13. -- low flags: 00
  14. -- high flags: A004
  15. -- rect: left=227 top=32 right=51 bottom=288
  16. -- title width / last selected line: 0
  17. -- icon id / first selected line: 0 / 0
  18. -- text alignment: 1
  19. -- font id: 0
  20. -- text size: 12
  21. -- style flags: 0
  22. -- line height: 16
  23. -- part name: Example
  24. ----- HyperTalk script -----
  25. on mousedown
  26.   if the optionkey is down then
  27.     edit script of target
  28.     exit mousedown
  29.   end if
  30.  
  31.   put the mouseloc into myPlace
  32.   put item 1 of myPlace - 20 into horiz
  33.   put item 2 of myPlace - 10 into vert
  34.   get PopUpMenu("Hello;my;name;is;Steve", 1, vert, horiz)
  35.   put "You chose item" && it
  36. end mousedown
  37.  
  38.  
  39.  
  40. -- part 2 (button)
  41. -- low flags: 00
  42. -- high flags: A004
  43. -- rect: left=299 top=32 right=51 bottom=360
  44. -- title width / last selected line: 0
  45. -- icon id / first selected line: 0 / 0
  46. -- text alignment: 1
  47. -- font id: 0
  48. -- text size: 12
  49. -- style flags: 0
  50. -- line height: 16
  51. -- part name: Another
  52. ----- HyperTalk script -----
  53. on mousedown
  54.   if the optionkey is down then
  55.     edit script of target
  56.     exit mousedown
  57.   end if
  58.  
  59.   put the mouseloc into myPlace
  60.   put item 1 of myPlace - 20 into horiz
  61.   put item 2 of myPlace - 10 into vert
  62.   get PopUpMenu("For;a;disk;catalog;of;BMUG's;stack;library;"& "Send;$3;To;BMUG;1442A;Walnut;#62;Berkeley;CA;94709", 5, vert, horiz)
  63.   put "You chose item" && it
  64. end mousedown
  65.  
  66.  
  67.  
  68. -- part 3 (button)
  69. -- low flags: 00
  70. -- high flags: A003
  71. -- rect: left=82 top=302 right=324 bottom=182
  72. -- title width / last selected line: 0
  73. -- icon id / first selected line: 0 / 0
  74. -- text alignment: 1
  75. -- font id: 0
  76. -- text size: 12
  77. -- style flags: 0
  78. -- line height: 16
  79. -- part name: Install
  80. ----- HyperTalk script -----
  81. on mouseUp
  82.   if the optionkey is down then
  83.     pass mouseup
  84.   end if
  85.  
  86.   put (long name of this stack) into sourceStack
  87.   delete first word of sourceStack
  88.   delete first character of sourceStack
  89.   delete last character of sourceStack
  90.   put "Select a stack to copy this resource into."
  91.   put filename("STAK") into fname
  92.   if fname is empty then
  93.     hide message window
  94.     exit mouseup
  95.   end if
  96.   if sourcestack=fname then
  97.     beep
  98.     Answer "Get real.  You can't install it in this stack"
  99.     hide message window
  100.     exit mouseup
  101.   end if
  102.  
  103.   --
  104.   ModResCopy sourceStack,fname,"XFCN","PopUpMenu"
  105.   --
  106.   get the result
  107.   if first char of it is "E" then
  108.     put it into the message box
  109.     beep
  110.     answer "Attempt to install resource has failed."
  111.   else
  112.     beep
  113.     answer "Resource installation successful"
  114.   end if
  115.   hide message window
  116. end mouseUp
  117.  
  118.  
  119.  
  120. -- part contents for background part 10
  121. ----- text -----
  122. 3
  123.  
  124. -- part contents for background part 5
  125. ----- text -----
  126. PopUpMenu
  127.  
  128. -- part contents for background part 6
  129. ----- text -----
  130.  
  131. This HyperCard external function returns the selection from a popup menu created from a hypercard item list (the first parameter).  The
  132. menu is placed on the screen so that the checked item is at the position (global) top,left.
  133.  
  134.  
  135.  
  136. Thanks to:
  137. Andrew Gilmartin
  138.  Brown University
  139.  
  140.  
  141.  
  142. -- part contents for background part 7
  143. ----- text -----
  144. Syntax:
  145.  
  146. PopUpMenu( "MenuItems", CheckedItem, Top, Left )
  147.  
  148.  
  149. "MenuItems" is a list of items seperated by commas that will comprise the menu.
  150.  
  151. <CheckedItem> is the number of the item that will be initially selected & checked.
  152.  
  153. <Top> is the vertical placement of the checked item. 
  154.  
  155. <Left> is the horizontal placement of the checked item.